package com.example.demo.mongodb;

import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * @ClassName SysUserServiceImpl
 * @Description:
 * @Author liyunjiang
 * @Date 2020/5/17 15:58
 */
@Service
public class SysUserServiceImpl implements SysUserService {
    @Resource
    SysUserRepository userRepository;
    @Override
    public void insert(SysUser user) {
        userRepository.insert(user);
    }

    @Override
    public List<SysUser> list() {
        return userRepository.findAll();
    }

    @Override
    public void delete(String id) {
        userRepository.deleteById(id);
    }

    @Override
    public SysUser findById(int id) {
        return userRepository.findById(id);
    }
}
